/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TelaPrincipal.java
 *
 * Created on 18/11/2010, 01:46:33
 */
package asfabdesk.apresentacao;

import asfabdesk.dominio.Associado;
import asfabdesk.dominio.Usuario;
import asfabdesk.presistencia.DAO;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author marco.machado
 */
public class TelaPrincipal extends javax.swing.JFrame {

    public Usuario usuario = TelaLogin.usuario;
    /** Creates new form TelaPrincipal */
    public TelaPrincipal() {
        initComponents();
        configurarTela();
    }

    public void configurarTela() {
        setTitle("Associação de Servidores e Funcionários Públicos de Armação dos Búzios - Sistema AsfabDesk 1.1.2");
        lblUsuario.setText(usuario.getNome());
    }

    public void configurarAcessos(){
        //financeiro
        btnFinanceiro.setEnabled(usuario.getNivelAcesso().isTelaFinanceiro());
        btnAssociados.setEnabled(usuario.getNivelAcesso().isTelaAssociados());
        menuAssociados.setEnabled(usuario.getNivelAcesso().isTelaAssociados());
        menuCatVinculo.setEnabled(usuario.getNivelAcesso().isCadVinculo());
        menuConvenios.setEnabled(usuario.getNivelAcesso().isTelaConvenios());
        btnConvenios.setEnabled(usuario.getNivelAcesso().isTelaConvenios());
        menuEmpresas.setEnabled(usuario.getNivelAcesso().isTelaEmpresas());
        
    }

    public void abrirIFrame(JInternalFrame janela) {
        for (JInternalFrame j : desktop.getAllFrames()) {
            if (janela.getClass() == j.getClass()) {
                j.moveToFront();
                return;
            }
        }
        desktop.add(janela);
        janela.setVisible(true);
    }

    public void acaoBuscar() {
        if (txtBusca.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Ops, preencha corretamente o campo de busca.", "Ops", 1);
        } else {
            buscaRapida(txtBusca.getText());
        }
    }

    public void buscaRapida(String busca) {
        Associado associado = new Associado();
        if (comboBusca.getSelectedIndex() == 0) {
            associado = new DAO().localizar(Associado.class, "AssociadoPorRol", Long.parseLong(busca));
        } else if (comboBusca.getSelectedIndex() == 1) {
            associado = new DAO().localizar(Associado.class, "AssociadoPorCpf", busca);
        } else if (comboBusca.getSelectedIndex() == 2) {
            associado = new DAO().localizar(Associado.class, "AssociadoPorIdentidade", busca);
        } else if (comboBusca.getSelectedIndex() == 3) {
            associado = new DAO().localizar(Associado.class, "AssociadoPorMatricula", busca);
        }

        if (associado != null) {
            JInternalFrame iFrame = new JInternalFrame();
            try {
                iFrame = new TelaAssociadoEdt(associado);
                iFrame.setVisible(true);
                desktop.add(iFrame);
                iFrame.moveToFront();
                txtBusca.setText("");
            } catch (SQLException ex) {
                Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Ops, nenhum Associado encontrado com os dados informado.", "Ops", 1);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        pnlBarraLateral = new javax.swing.JPanel();
        pnlbuscaRol = new javax.swing.JPanel();
        btnBuscar = new javax.swing.JButton();
        txtBusca = new javax.swing.JTextField();
        comboBusca = new javax.swing.JComboBox();
        imgLogo = new javax.swing.JLabel();
        pnlMenuPrincipal = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        btnAssociados = new javax.swing.JButton();
        btnFinanceiro = new javax.swing.JButton();
        btnProcessos = new javax.swing.JButton();
        btnConvenios = new javax.swing.JButton();
        desktop = new javax.swing.JDesktopPane();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jLabel2 = new javax.swing.JLabel();
        lblUsuario = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu menuArquivo = new javax.swing.JMenu();
        menuAssociados = new javax.swing.JMenuItem();
        menuProcessos = new javax.swing.JMenuItem();
        menuConvenios = new javax.swing.JMenuItem();
        menuEmpresas = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        menuSeguranca = new javax.swing.JMenu();
        menuNivelAcesso = new javax.swing.JMenuItem();
        menuUsuarios = new javax.swing.JMenuItem();
        menuNovoUsuario = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenu7 = new javax.swing.JMenu();
        menuSecretarias = new javax.swing.JMenuItem();
        menuCatVinculo = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        menuContas = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        menuSobre = new javax.swing.JMenu();
        menuSair = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(asfabdesk.apresentacao.AsfabDeskApp.class).getContext().getResourceMap(TelaPrincipal.class);
        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setName("mainPanel"); // NOI18N
        mainPanel.setPreferredSize(new java.awt.Dimension(1024, 768));

        pnlBarraLateral.setName("pnlBarraLateral"); // NOI18N
        pnlBarraLateral.setOpaque(false);
        pnlBarraLateral.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        pnlbuscaRol.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("pnlbuscaRol.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), resourceMap.getColor("pnlbuscaRol.border.titleColor"))); // NOI18N
        pnlbuscaRol.setName("pnlbuscaRol"); // NOI18N
        pnlbuscaRol.setOpaque(false);

        btnBuscar.setText(resourceMap.getString("btnBuscar.text")); // NOI18N
        btnBuscar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnBuscar.setName("btnBuscar"); // NOI18N
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        txtBusca.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtBusca.setName("txtBusca"); // NOI18N
        txtBusca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtBuscaActionPerformed(evt);
            }
        });

        comboBusca.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ROL", "CPF", "Identidade", "Matrícula PMAB" }));
        comboBusca.setName("comboBusca"); // NOI18N

        javax.swing.GroupLayout pnlbuscaRolLayout = new javax.swing.GroupLayout(pnlbuscaRol);
        pnlbuscaRol.setLayout(pnlbuscaRolLayout);
        pnlbuscaRolLayout.setHorizontalGroup(
            pnlbuscaRolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlbuscaRolLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlbuscaRolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnBuscar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
                    .addComponent(txtBusca, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
                    .addComponent(comboBusca, 0, 128, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlbuscaRolLayout.setVerticalGroup(
            pnlbuscaRolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlbuscaRolLayout.createSequentialGroup()
                .addComponent(comboBusca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtBusca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pnlBarraLateral.add(pnlbuscaRol, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 420, 160, -1));

        imgLogo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        imgLogo.setIcon(resourceMap.getIcon("imgLogo.icon")); // NOI18N
        imgLogo.setName("imgLogo"); // NOI18N
        imgLogo.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        pnlBarraLateral.add(imgLogo, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, 160, 110));

        pnlMenuPrincipal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("pnlMenuPrincipal.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), resourceMap.getColor("pnlMenuPrincipal.border.titleColor"))); // NOI18N
        pnlMenuPrincipal.setName("pnlMenuPrincipal"); // NOI18N
        pnlMenuPrincipal.setOpaque(false);

        jToolBar1.setFloatable(false);
        jToolBar1.setOrientation(1);
        jToolBar1.setRollover(true);
        jToolBar1.setBorderPainted(false);
        jToolBar1.setName("jToolBar1"); // NOI18N
        jToolBar1.setOpaque(false);

        btnAssociados.setIcon(resourceMap.getIcon("btnAssociados.icon")); // NOI18N
        btnAssociados.setText(resourceMap.getString("btnAssociados.text")); // NOI18N
        btnAssociados.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnAssociados.setFocusable(false);
        btnAssociados.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnAssociados.setMaximumSize(new java.awt.Dimension(150, 150));
        btnAssociados.setName("btnAssociados"); // NOI18N
        btnAssociados.setOpaque(false);
        btnAssociados.setPreferredSize(new java.awt.Dimension(155, 55));
        btnAssociados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAssociadosActionPerformed(evt);
            }
        });
        jToolBar1.add(btnAssociados);

        btnFinanceiro.setIcon(resourceMap.getIcon("btnFinanceiro.icon")); // NOI18N
        btnFinanceiro.setText(resourceMap.getString("btnFinanceiro.text")); // NOI18N
        btnFinanceiro.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnFinanceiro.setFocusable(false);
        btnFinanceiro.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnFinanceiro.setMaximumSize(new java.awt.Dimension(150, 150));
        btnFinanceiro.setName("btnFinanceiro"); // NOI18N
        btnFinanceiro.setOpaque(false);
        btnFinanceiro.setPreferredSize(new java.awt.Dimension(155, 55));
        btnFinanceiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFinanceiroActionPerformed(evt);
            }
        });
        jToolBar1.add(btnFinanceiro);

        btnProcessos.setIcon(resourceMap.getIcon("btnProcessos.icon")); // NOI18N
        btnProcessos.setText(resourceMap.getString("btnProcessos.text")); // NOI18N
        btnProcessos.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnProcessos.setEnabled(false);
        btnProcessos.setFocusable(false);
        btnProcessos.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnProcessos.setMaximumSize(new java.awt.Dimension(150, 150));
        btnProcessos.setName("btnProcessos"); // NOI18N
        btnProcessos.setOpaque(false);
        btnProcessos.setPreferredSize(new java.awt.Dimension(103, 55));
        jToolBar1.add(btnProcessos);

        btnConvenios.setIcon(resourceMap.getIcon("btnConvenios.icon")); // NOI18N
        btnConvenios.setText(resourceMap.getString("btnConvenios.text")); // NOI18N
        btnConvenios.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnConvenios.setFocusable(false);
        btnConvenios.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnConvenios.setMaximumSize(new java.awt.Dimension(150, 150));
        btnConvenios.setName("btnConvenios"); // NOI18N
        btnConvenios.setOpaque(false);
        btnConvenios.setPreferredSize(new java.awt.Dimension(105, 55));
        btnConvenios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConveniosActionPerformed(evt);
            }
        });
        jToolBar1.add(btnConvenios);

        javax.swing.GroupLayout pnlMenuPrincipalLayout = new javax.swing.GroupLayout(pnlMenuPrincipal);
        pnlMenuPrincipal.setLayout(pnlMenuPrincipalLayout);
        pnlMenuPrincipalLayout.setHorizontalGroup(
            pnlMenuPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMenuPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pnlMenuPrincipalLayout.setVerticalGroup(
            pnlMenuPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlMenuPrincipalLayout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlBarraLateral.add(pnlMenuPrincipal, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 150, 160, -1));

        desktop.setBackground(resourceMap.getColor("desktop.background")); // NOI18N
        desktop.setName("desktop"); // NOI18N

        statusPanel.setBackground(resourceMap.getColor("statusPanel.background")); // NOI18N
        statusPanel.setName("statusPanel"); // NOI18N
        statusPanel.setPreferredSize(new java.awt.Dimension(1049, 35));

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setForeground(resourceMap.getColor("jLabel2.foreground")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        lblUsuario.setFont(resourceMap.getFont("lblUsuario.font")); // NOI18N
        lblUsuario.setForeground(resourceMap.getColor("lblUsuario.foreground")); // NOI18N
        lblUsuario.setName("lblUsuario"); // NOI18N

        jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel3.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 1004, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(statusAnimationLabel)
                    .addComponent(statusMessageLabel, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, statusPanelLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 357, Short.MAX_VALUE)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel1)
                                .addComponent(jLabel3))
                            .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(statusMessageLabel)
                            .addComponent(statusAnimationLabel)))))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(statusPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1004, Short.MAX_VALUE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(pnlBarraLateral, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(desktop, javax.swing.GroupLayout.DEFAULT_SIZE, 817, Short.MAX_VALUE)))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlBarraLateral, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE)
                    .addComponent(desktop, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(statusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        menuBar.setBackground(resourceMap.getColor("menuBar.background")); // NOI18N
        menuBar.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, resourceMap.getColor("menuBar.border.matteColor"))); // NOI18N
        menuBar.setName("menuBar"); // NOI18N

        menuArquivo.setBackground(resourceMap.getColor("menuArquivo.background")); // NOI18N
        menuArquivo.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, resourceMap.getColor("menuArquivo.border.matteColor"))); // NOI18N
        menuArquivo.setText(resourceMap.getString("menuArquivo.text")); // NOI18N
        menuArquivo.setName("menuArquivo"); // NOI18N

        menuAssociados.setText(resourceMap.getString("menuAssociados.text")); // NOI18N
        menuAssociados.setName("menuAssociados"); // NOI18N
        menuAssociados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuAssociadosActionPerformed(evt);
            }
        });
        menuArquivo.add(menuAssociados);

        menuProcessos.setText(resourceMap.getString("menuProcessos.text")); // NOI18N
        menuProcessos.setEnabled(false);
        menuProcessos.setName("menuProcessos"); // NOI18N
        menuArquivo.add(menuProcessos);

        menuConvenios.setText(resourceMap.getString("menuConvenios.text")); // NOI18N
        menuConvenios.setName("menuConvenios"); // NOI18N
        menuConvenios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuConveniosActionPerformed(evt);
            }
        });
        menuArquivo.add(menuConvenios);

        menuEmpresas.setText(resourceMap.getString("menuEmpresas.text")); // NOI18N
        menuEmpresas.setName("menuEmpresas"); // NOI18N
        menuEmpresas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuEmpresasActionPerformed(evt);
            }
        });
        menuArquivo.add(menuEmpresas);

        jMenuItem9.setText(resourceMap.getString("jMenuItem9.text")); // NOI18N
        jMenuItem9.setEnabled(false);
        jMenuItem9.setName("jMenuItem9"); // NOI18N
        menuArquivo.add(jMenuItem9);

        jSeparator1.setName("jSeparator1"); // NOI18N
        menuArquivo.add(jSeparator1);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(asfabdesk.apresentacao.AsfabDeskApp.class).getContext().getActionMap(TelaPrincipal.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N
        exitMenuItem.setBorder(null);
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        menuArquivo.add(exitMenuItem);

        menuBar.add(menuArquivo);

        jMenu1.setBackground(resourceMap.getColor("jMenu1.background")); // NOI18N
        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        menuSeguranca.setText(resourceMap.getString("menuSeguranca.text")); // NOI18N
        menuSeguranca.setName("menuSeguranca"); // NOI18N

        menuNivelAcesso.setText(resourceMap.getString("menuNivelAcesso.text")); // NOI18N
        menuNivelAcesso.setName("menuNivelAcesso"); // NOI18N
        menuSeguranca.add(menuNivelAcesso);

        menuUsuarios.setText(resourceMap.getString("menuUsuarios.text")); // NOI18N
        menuUsuarios.setName("menuUsuarios"); // NOI18N
        menuSeguranca.add(menuUsuarios);

        menuNovoUsuario.setText(resourceMap.getString("menuNovoUsuario.text")); // NOI18N
        menuNovoUsuario.setName("menuNovoUsuario"); // NOI18N
        menuNovoUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuNovoUsuarioActionPerformed(evt);
            }
        });
        menuSeguranca.add(menuNovoUsuario);

        jMenu1.add(menuSeguranca);

        jMenu6.setText(resourceMap.getString("jMenu6.text")); // NOI18N
        jMenu6.setName("jMenu6"); // NOI18N

        jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N
        jMenuItem7.setEnabled(false);
        jMenuItem7.setName("jMenuItem7"); // NOI18N
        jMenu6.add(jMenuItem7);

        jMenuItem8.setText(resourceMap.getString("jMenuItem8.text")); // NOI18N
        jMenuItem8.setEnabled(false);
        jMenuItem8.setName("jMenuItem8"); // NOI18N
        jMenu6.add(jMenuItem8);

        jMenu1.add(jMenu6);

        jMenu7.setText(resourceMap.getString("jMenu7.text")); // NOI18N
        jMenu7.setName("jMenu7"); // NOI18N

        menuSecretarias.setText(resourceMap.getString("menuSecretarias.text")); // NOI18N
        menuSecretarias.setName("menuSecretarias"); // NOI18N
        menuSecretarias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSecretariasActionPerformed(evt);
            }
        });
        jMenu7.add(menuSecretarias);

        menuCatVinculo.setText(resourceMap.getString("menuCatVinculo.text")); // NOI18N
        menuCatVinculo.setName("menuCatVinculo"); // NOI18N
        menuCatVinculo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCatVinculoActionPerformed(evt);
            }
        });
        jMenu7.add(menuCatVinculo);

        jMenu1.add(jMenu7);

        menuBar.add(jMenu1);

        jMenu2.setBackground(resourceMap.getColor("jMenu2.background")); // NOI18N
        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setEnabled(false);
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenu2.add(jMenuItem1);

        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setEnabled(false);
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenu2.add(jMenuItem2);

        menuContas.setText(resourceMap.getString("menuContas.text")); // NOI18N
        menuContas.setName("menuContas"); // NOI18N

        jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N
        jMenuItem4.setName("jMenuItem4"); // NOI18N
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menuContas.add(jMenuItem4);

        jMenuItem6.setText(resourceMap.getString("jMenuItem6.text")); // NOI18N
        jMenuItem6.setName("jMenuItem6"); // NOI18N
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        menuContas.add(jMenuItem6);

        jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N
        jMenuItem3.setName("jMenuItem3"); // NOI18N
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menuContas.add(jMenuItem3);

        jMenu2.add(menuContas);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N

        jMenuItem10.setText(resourceMap.getString("jMenuItem10.text")); // NOI18N
        jMenuItem10.setName("jMenuItem10"); // NOI18N
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem10);

        jMenuItem11.setText(resourceMap.getString("jMenuItem11.text")); // NOI18N
        jMenuItem11.setName("jMenuItem11"); // NOI18N
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem11);

        jMenuItem12.setText(resourceMap.getString("jMenuItem12.text")); // NOI18N
        jMenuItem12.setName("jMenuItem12"); // NOI18N
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem12);

        jMenuItem13.setText(resourceMap.getString("jMenuItem13.text")); // NOI18N
        jMenuItem13.setName("jMenuItem13"); // NOI18N
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem13);

        jMenu2.add(jMenu3);

        menuBar.add(jMenu2);

        jMenu5.setBackground(resourceMap.getColor("jMenu5.background")); // NOI18N
        jMenu5.setText(resourceMap.getString("jMenu5.text")); // NOI18N
        jMenu5.setName("jMenu5"); // NOI18N
        menuBar.add(jMenu5);

        jMenu4.setBackground(resourceMap.getColor("jMenu4.background")); // NOI18N
        jMenu4.setText(resourceMap.getString("jMenu4.text")); // NOI18N
        jMenu4.setName("jMenu4"); // NOI18N
        menuBar.add(jMenu4);

        menuSobre.setBackground(resourceMap.getColor("menuSobre.background")); // NOI18N
        menuSobre.setText(resourceMap.getString("menuSobre.text")); // NOI18N
        menuSobre.setName("menuSobre"); // NOI18N
        menuBar.add(menuSobre);

        menuSair.setBackground(resourceMap.getColor("menuSair.background")); // NOI18N
        menuSair.setText(resourceMap.getString("menuSair.text")); // NOI18N
        menuSair.setName("menuSair"); // NOI18N
        menuBar.add(menuSair);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        acaoBuscar();
}//GEN-LAST:event_btnBuscarActionPerformed

    private void txtBuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBuscaActionPerformed
        acaoBuscar();
}//GEN-LAST:event_txtBuscaActionPerformed

    private void btnAssociadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAssociadosActionPerformed
        try {
            abrirIFrame(new TelaAssociados());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnAssociadosActionPerformed

    private void btnFinanceiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinanceiroActionPerformed
       try {
            abrirIFrame(new TelaFinanceiro());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_btnFinanceiroActionPerformed

    private void btnConveniosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConveniosActionPerformed
        try {
            abrirIFrame(new TelaConvenios());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_btnConveniosActionPerformed

    private void menuAssociadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAssociadosActionPerformed
        try {
            abrirIFrame(new TelaAssociados());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_menuAssociadosActionPerformed

    private void menuConveniosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuConveniosActionPerformed
        try {
            abrirIFrame(new TelaConvenios());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_menuConveniosActionPerformed

    private void menuEmpresasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEmpresasActionPerformed
        try {
            abrirIFrame(new TelaEmpresas());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_menuEmpresasActionPerformed

    private void menuNovoUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNovoUsuarioActionPerformed
        try {
            abrirIFrame(new TelaCadastroUsuario());
        } catch (SQLException ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_menuNovoUsuarioActionPerformed

    private void menuSecretariasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSecretariasActionPerformed
        try {
            abrirIFrame(new TelaSecretaria());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_menuSecretariasActionPerformed

    private void menuCatVinculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCatVinculoActionPerformed
        try {
            abrirIFrame(new TelaCategoriaDeVinculo());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_menuCatVinculoActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
        try {
            abrirIFrame(new TelaFinDeposito());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
         try {
            abrirIFrame(new TelaFinTipoEntrada());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
        try {
            abrirIFrame(new TelaFinTipoSaida());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
        try {
            abrirIFrame(new TelaFinCentroCusto());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        try {
            abrirIFrame(new TelaFinEntrada());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        try {
            abrirIFrame(new TelaFinSaida());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        try {
            abrirIFrame(new TelaFinTransferencia());
        } catch (Exception ex) {
            Logger.getLogger(AsfabDeskView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAssociados;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnConvenios;
    private javax.swing.JButton btnFinanceiro;
    private javax.swing.JButton btnProcessos;
    private javax.swing.JComboBox comboBusca;
    protected static javax.swing.JDesktopPane desktop;
    private javax.swing.JLabel imgLogo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel lblUsuario;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuItem menuAssociados;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem menuCatVinculo;
    private javax.swing.JMenu menuContas;
    private javax.swing.JMenuItem menuConvenios;
    private javax.swing.JMenuItem menuEmpresas;
    private javax.swing.JMenuItem menuNivelAcesso;
    private javax.swing.JMenuItem menuNovoUsuario;
    private javax.swing.JMenuItem menuProcessos;
    private javax.swing.JMenu menuSair;
    private javax.swing.JMenuItem menuSecretarias;
    private javax.swing.JMenu menuSeguranca;
    private javax.swing.JMenu menuSobre;
    private javax.swing.JMenuItem menuUsuarios;
    private javax.swing.JPanel pnlBarraLateral;
    private javax.swing.JPanel pnlMenuPrincipal;
    private javax.swing.JPanel pnlbuscaRol;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JTextField txtBusca;
    // End of variables declaration//GEN-END:variables
}
